package com.qiangqiang.task.server.ranking.entity;

import lombok.Data;

import java.util.Objects;

/**
 * @program: task
 * @description:
 * @author: Sky.lin
 * @create: 2019-02-12 00:40
 **/
@Data
public class RankingUser {
    private long userId; // 使用userId 标明用户创建的时间，因为userId也是递增的
    private String nickName;
    private int achievement;

    private int ranking;

    public RankingUser() {
    }

    public RankingUser(String nickName, int achievement, long userId) {
        this.nickName = nickName;
        this.achievement = achievement;
        this.userId = userId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RankingUser that = (RankingUser) o;
        return userId == that.userId &&
                Objects.equals(nickName, that.nickName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, nickName);
    }
}
